<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {margin: 0;overflow: hidden;}
    #canvas {background-color: antiquewhite;}
  </style>
</head>
<body>

  <canvas id="canvas"></canvas>
  <script>
    const canvas = document.querySelector('#canvas');
    canvas.width = window.innerWidth;
    canvas.height = window.innerHeight;
    const ctx = canvas.getContext('2d');

    // 颜色
    ctx.fillStyle = 'yellow';
    // 描边宽度
    ctx.lineWidth = 20;
    /* 填充矩形方法: fillRect(x,y,w,h) */
    ctx.fillRect(50,100,400,200);
    /* 描边矩形方法: strokeRect(x,y,w,h) */
    ctx.strokeRect(50,100,400,200);
    /* 清理矩形方法: clearRect(x,y,w,h) */
    ctx.clearRect(50,100,400,200);

  </script>

</body>
</html>